package com.revelvy.controller;

import com.revelvy.pojo.*;
import com.revelvy.utils.Meta;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.HashMap;

/**
 * Author: Revelvy
 */
@Controller
public class MenusController {

    @GetMapping("/menus")
    @ResponseBody
    public Menu menus() {

        ArrayList<MenuData> menuDataArrayList = new ArrayList<>();
        ArrayList<SubMenuData> usersArrayList = new ArrayList<>();
        ArrayList<SubMenuData> rightsArrayList = new ArrayList<>();
        ArrayList<SubMenuData> goodsArrayList = new ArrayList<>();
        ArrayList<SubMenuData> ordersArrayList = new ArrayList<>();
        ArrayList<SubMenuData> datasArrayList = new ArrayList<>();
        SubMenuData subMenuData1 = new SubMenuData(201, "用户列表", "users", "1");
        SubMenuData subMenuData20 = new SubMenuData(2020, "角色列表", "roles", "20");
        SubMenuData subMenuData21 = new SubMenuData(2021, "权限列表", "rights", "21");
        SubMenuData subMenuData30 = new SubMenuData(2030, "商品列表", "goods", "30");
        SubMenuData subMenuData31 = new SubMenuData(2031, "分类参数", "argus", "31");
        SubMenuData subMenuData32 = new SubMenuData(2032, "商品分类", "goodss", "32");
        SubMenuData subMenuData4 = new SubMenuData(204, "订单列表", "orders", "4");
        SubMenuData subMenuData5 = new SubMenuData(205, "数据列表", "datas", "5");
        usersArrayList.add(subMenuData1);
        rightsArrayList.add(subMenuData20);
        rightsArrayList.add(subMenuData21);
        goodsArrayList.add(subMenuData30);
        goodsArrayList.add(subMenuData31);
        goodsArrayList.add(subMenuData32);
        ordersArrayList.add(subMenuData4);
        datasArrayList.add(subMenuData5);
        MenuData menuData1 = new MenuData(101, "用户管理", "users", usersArrayList);
        MenuData menuData2 = new MenuData(102, "权限管理", "rights", rightsArrayList);
        MenuData menuData3 = new MenuData(103, "商品管理", "goods", goodsArrayList);
        MenuData menuData4 = new MenuData(104, "订单管理", "orders", ordersArrayList);
        MenuData menuData5 = new MenuData(105, "数据统计", "reports", datasArrayList);
        menuDataArrayList.add(menuData1);
        menuDataArrayList.add(menuData2);
        menuDataArrayList.add(menuData3);
        menuDataArrayList.add(menuData4);
        menuDataArrayList.add(menuData5);

        HashMap<String, Object> hashMap = new HashMap<>();

        Meta meta=new Meta("获取菜单列表成功",200);
        Menu menu = new Menu(menuDataArrayList, meta);
        return menu;
    }

}
